x11: be more verbose when glClientWaitSync behaves unexpectedtly
authorRay Strode <rstrode@redhat.com>
Mon, 22 Jun 2020 15:07:32 +0000 (11:07 -0400)
committerRay Strode <rstrode@redhat.com>
Mon, 22 Jun 2020 15:16:32 +0000 (11:16 -0400)
When given a 0 timeout, glClientWaitSync is only supposed to return one
of three possible values:

 - GL_ALREADY_SIGNALED - fence fired
 - GL_WAIT_FAILED - there was an error
 - GL_TIMEOUT_EXPIRED - fence hasn't fired yet

In addition, it can also return GL_CONDITION_SATISFIED if a non-zero
timeout is passed, and the fence fires while waiting on the timeout.

Since commit 972134abe48a4c9c7b6ad41b0723f30f4e7ae16b we now call
glClientWaitSync (with a 0 timeout), but one user is reporting it's
returning some value that's not one of the above four.

This commit changes the g_assert to a g_error so we can see what
value is getting returned.

May help with https://gitlab.gnome.org/GNOME/gtk/-/issues/2858

gdk/x11/gdkglcontext-x11.c

index 72c775885b30d852a9ef1f66bf051b630d9c8bb5..834d23ac931abb77943ded0b76a0e665d812daeb 100644 (file)
@@ -648,7 +648,7 @@ on_gl_surface_xevent (GdkGLContext   *context,
           case GL_TIMEOUT_EXPIRED:
             break;
           default:
-            g_assert_not_reached ();
+            g_error ("glClientWaitSync returned unexpected result: %x", (guint) wait_result);
         }
     }